package com.wsl;

import com.wsl.config.ScopeConfig;
import com.wsl.service.DemoService;
import com.wsl.service.DemoSingletonService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author:WangShuliang
 * @Description:
 * @Date:Created in 10:22 2017/11/24
 * @Modified by:
 */
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext  context = new AnnotationConfigApplicationContext(ScopeConfig.class);
        DemoService service1 = context.getBean(DemoService.class);
        DemoService service2 = context.getBean(DemoService.class);

        DemoSingletonService singletonService = context.getBean(DemoSingletonService.class);
        DemoSingletonService singletonService1 = context.getBean(DemoSingletonService.class);


        System.out.println("测试多例"+service1.equals(service2));
        System.out.println("测试单例"+singletonService.equals(singletonService1));


    }
}